#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include <QMainWindow>
#include <QListWidgetItem>
#include <QInputDialog>
#include <QStringListModel>
#include "Code/ui/scan_gobang.h"
#include "Code/net/gobang_network.h"
#include "Code/ui/LoadMessage.h"
#include "Code/net/net_pthread.h"
#include "Code/ui/room_item.h"
#include "Code/ui/home.h"
#include "Code/ui/set.h"
#include "Code/ui/about.h"

//调用WIN API需要用到的头文件与库 [实现缩放]
#ifdef Q_OS_WIN
#include <qt_windows.h>
#include <Windowsx.h>
#endif

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
public:
    void draw_chess();
    void paintEvent(QPaintEvent*); //Qt所有的绘制都只能在此函数中完成
    void bind_tcp();
public slots:
    void slotshow();
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
private slots:
    void create_succead();
    void join_succeed(uint16_t tell_id);
    bool nativeEvent(const QByteArray &eventType, void *message, long *result);

    void on_toolButton_exit_clicked();

    void on_toolButton_min_clicked();

    void on_toolButton_magnify_clicked();

    void on_pushButton_home_clicked();

    void on_pushButton_set_clicked();

    void on_pushButton_about_clicked();

    void on_Aimode_clicked();

public slots:
    void get_id(uint16_t id);
    void on_create_room();
private:
    Ui::MainWindow *ui;

    QStringListModel *listmodel;

    QPoint whereismouse;
    int m_nBorderWidth; //m_nBorder表示鼠标位于边框缩放范围的宽度

    int mode=0;
    int page_index[3];
    void mode_setStyle(int mode);
    void create_gobang();
public:
    scan_gobang *gobang=nullptr;
    QStringList list;
    Gobang_Network *gn;

    home *h;
    set *s;
    about *a;
private:
    void update_window();
};

#endif // MAINWINDOW_H
